/*
ID:luongho3
LANG:JAVA
TASK:latin
 */
import java.io.File;
import java.io.PrintStream;
import java.util.Scanner;


public class latin {

	static int N, sum;
	static long count;
	static int[][] m;
	static int[][] cro, cco;
	
	public static void main(String[] args) throws Exception {
		Scanner scanner = new Scanner(new File("latin.in"));
		N = scanner.nextInt();
		if (N < 8) {
			sum = (N+1) * N / 2;
			m = new int[N+1][N+1];
			cro = new int[N+1][N+1];
			cco = new int[N+1][N+1];
			for (int i=1;i<=N;++i) {
				m[1][i] = i;
				cro[1][i]++;
				cco[i][i]++;
			}
			for (int i=2;i<=N;++i) {
				m[i][1] = i;
				cro[i][i]++;
				cco[1][i]++;
			}
			count = 0;
			for (int i=1;i<=N;++i) {
				if (cco[2][i] == 0 && cro[2][i] == 0) {
					cco[2][i]++;
					cro[2][i]++;
					dfs(2,2,i);
					cco[2][i]--;
					cro[2][i]--;
				}
			}
		}
//		else if (N == 7) {
//			count = 12198297600L;
//		}
//		else if (N == 6) {
//			count = 1128960;
//		}
		
		PrintStream ps = System.out;
		PrintStream out = new PrintStream(new File("latin.out"));
//		System.setOut(out);
		System.out.println(count * fct(N-1));
//		System.setOut(ps);
	}

	private static long fct(int n) {
		long pro = 1;
		for (int i=1;i<=n;++i) {
			pro *= i;
		}
		return pro;
	}

	private static void dfs(int r, int c, int num) {
		
		m[r][c] = num;
		
		if (r == N && c == N) {
			count++;
		}
		else if (c == N) {
			for (int i=1;i<=N;++i) {
				if (cco[2][i] == 0 && cro[r+1][i] == 0) {
					cco[2][i]++;
					cro[r+1][i]++;
					dfs(r+1,2,i);
					cco[2][i]--;
					cro[r+1][i]--;
				}
			}
		}
		else {
			for (int i=1;i<=N;++i) {
				if (cco[c+1][i] == 0 && cro[r][i] == 0) {
					cco[c+1][i]++;
					cro[r][i]++;
					dfs(r,c+1,i);
					cco[c+1][i]--;
					cro[r][i]--;
				}
			}
		}
		
	}

}
